
<?php
$current_route = strstr(Route::currentRouteName(), '/'); //loai bo chu sv - cb -tbm - qtht dau
$current_id = null;
$menus = '';

$pos = stripos(substr($current_route, 1), '/');
if ($pos === false) {
    $current_id = substr($current_route, 1);
} else {
    $current_id = substr($current_route, 1, $pos);
}

if (Session::has('tmenu')) {
    $menus = Session::get('tmenu');
    if ($menus[0] != $current_id) {
        Login::getMenu(Session::get('quyen'), $current_id);
    }
} else {
    Login::getMenu(Session::get('quyen'), $current_id);
}
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
        <td valign="top" >
            <ul id="navbar">
                <?php
                    $menu = Session::get('tmenu.menu');
                    $link = Session::get('tmenu.link');
                    for ($i = 0; $i < count($menu); $i++) {
                        echo "<li><a href='" . URL . Session::get('quyen') . "/" . $current_id . "/" . $link[$i] . "'>" . $menu[$i] . "</a></li>";
                    }
                    ?>
            </ul>
        </td>
    </tr>
</table>
<style type="text/css"> 
    #navbar { 
        margin: 0;
        padding: 0;
        height: 25px;} 
    #navbar li { 
        list-style: none; 
        float: left; 
        font-size:14px; 
        font-weight:bold;
        border: 1px solid #ccc
    } 
    #navbar li a { 
        display: block;
        padding: 3px 8px; 
        background:url(<?= URL ?>public/images/bg_header.gif); 
        color: #fff; 
        text-decoration: none;
        width:200px; 
        text-align:center;
    } 
    #navbar li ul { 
        display: none; 
        width:183px;
        background:url(<?= URL ?>public/images/bg_header.gif);
    } 							
    #navbar li:hover ul, #navbar li.hover ul { 
        display: block; 
        position: absolute; 
        margin: 0; 
        padding: 0; 
    } 
    #navbar li:hover li, #navbar li.hover li { 
        float: none; 
    } 
    #navbar li:hover li a, #navbar li.hover li a { 
        color:white;
    } 
    #navbar li a:hover {
        background:url(<?= URL ?>public/images/header.gif); 
    } 
</style>